import os
import sys
print("sys.path: ", sys.path)
print("PATH: ", os.environ.get("PATH"))
print("PYTHONPATH: ",os.environ.get('PYTHONPATH'))

def add_path_dll_directories():
    if sys.platform == "win32":
        # 获取系统 PATH 环境变量
        path_env = os.environ.get("PATH", "")
    
        # 根据操作系统选择分隔符
        separator = ";" if os.name == "nt" else ":"
    
        # 拆分 PATH 并过滤空路径
        paths = [p.strip() for p in path_env.split(separator) if p.strip()]
    
        # 逐个添加目录
        for path in paths:
            try:
                os.add_dll_directory(path)
            except (FileNotFoundError, OSError) as e:
                print(f"Warning: Failed to add DLL directory '{path}': {e}")
    else:
        pass